﻿@model IEnumerable<CSP.Receipts.DataModel.Receipt>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Meine Rezepte</h2>
<p>
    @Html.ActionLink("Neues Rezept erstellen", "Create")
</p>
<table class="maxWidth">
    <thead>
        <tr>
            <th>
                Kategorie
            </th>
            <th>
                Rezepttitel
            </th>
            <th>
                erstellt am
            </th>
            <th>
                Link
            </th>
            <th>
            </th>
        </tr>
        <tr>
            <th colspan="5">
                Zubereitungsauszug
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @item.Category.Title
                </td>
                <td>
                    @item.Title
                </td>
                <td>
                    @String.Format("{0:g}", item.CreationDate)
                </td>
                <td>
                    <a href="@item.Url">@item.Url</a>
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                    @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.Id })
                </td>
            </tr>
            <tr >
                <td colspan="5" style="padding-top: 10px; padding-bottom: 10px;">
                    @(item.ReceiptText.Length > 200 ? item.ReceiptText.Substring(0,200) : item.ReceiptText)
                </td>
            </tr>
        }
    </tbody>
</table>
